package com.example.springboot.Jms;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

@Component
public class JMSConsumer {

    @JmsListener(destination = "queue.test")//对目的为queue.test的消息进行监听，并打印信息
    public void receiveMsg(String text) {
        System.out.println("收到消息： " + text);
    }

    @JmsListener(destination = "topic.test")
    public void receiveTopicMsg(String text) {
        System.out.println("收到消息： " + text);
    }

}